import bus from '@/bus'
const onSetColor = (data) => {
  let color = 'red'
  if (Number(data) < 0) color = 'green'
  return {
    style: {
      color: color
    }
  }
}
const data = {
  pageData: {
    current: 1,
    size: 20,
    data: [],
    distributor: '',
    total: '',
    status: 'pass',
    columns: [{
        type: 'selection',
        width: 60,
        align: 'left',
      },
      {
        title: '经销商',
        key: 'btypeName',
        align: 'left',
        minWidth: 200,
        tooltip: true
      },
      {
        title: '物料名称',
        key: 'materialName',
        align: 'left',
        minWidth: 200,
        tooltip: true
      }, {
        title: '实际发货数',
        key: 'quantity',
        align: 'right',
        minWidth: 130
      }, {
        title: '处理标记',
        key: 'isProcess',
        align: 'left',
        minWidth: 130,
        render: (h, p) => {
          let status = p.row.isProcess ? '已处理' : '未处理'
          return h('div', status)
        }
      }
    ],
    form: {
      stockOutSn:''
    }
  },
  pageData1: {
    current: 1,
    size: 20,
    data: [],
    total: '',
    status: 'pass',
    columns: [{
      title: '出库单编号',
      key: 'stockOutSn',
      align: 'left',
      minWidth: 200
    }, {
      title: '物料名称',
      key: 'materialName',
      align: 'left',
      minWidth: 250,
      tooltip: true
    }, {
      title: '客户名称',
      key: 'btypeName',
      align: 'left',
      minWidth: 200,
      tooltip: true
    }, {
      title: '实际发货数',
      key: 'quantity',
      align: 'right',
      minWidth: 130
    }, {
      title: '处理标记',
      key: 'isProcess',
      align: 'left',
      minWidth: 130,
      render: (h, p) => {
        let status = p.row.isProcess ? '已处理' : '未处理'
        return h('div', status)
      }
    }, {
        title: '处理时间',
        key: 'processDate',
        align: 'left',
        minWidth: 200
      },{
      title: '操作',
      key: 'name',
      align: 'right',
      minWidth: 100,
      render: (h, p) => {
        let btn = h('div', [
          h('Button', {
            props: {
              type: 'primary',
              size: 'small'
            },
            on: {
              click() {
                bus.$emit("onDetail", {
                  item: p.row
                })
              }
            }
          }, '查看')
        ])
        return btn
      }
    }],
    form: {
      stockOutSn:'',
      date:''
    }
  },
  pageData2: {
    current: 1,
    size: 20,
    data: [],
    total: '',
    status: 'pass',
    columns: [{
      title: '出库单编号',
      key: 'stockOutSn',
      align: 'left',
      minWidth: 200
    }, {
      title: '工厂直发',
      key: 'isProcess',
      align: 'left',
      minWidth: 100,
      render: (h, p) => {
        let status = p.row.isFactoryDirect ? '是' : '否'
        return h('div', status)
      }
    },{
      title: '物料名称',
      key: 'materialName',
      align: 'left',
      minWidth: 250,
      tooltip: true
    }, {
      title: '客户名称',
      key: 'btypeName',
      align: 'left',
      minWidth: 200,
      tooltip: true
    }, {
      title: '条码',
      key: 'barcode',
      align: 'left',
      minWidth: 200
    },
    {
      title: '标签码',
      key: 'qrcode',
      align: 'left',
      minWidth: 200
    }, {
      title: '条码状态',
      key: 'barcodeStatus',
      align: 'left',
      minWidth: 150,
      render: (h, p) => {
        let status = p.row.barcodeStatus
        if(status == '-2'){
          status ='历史库存'
        } else if(status == 0){
          status ='经销商入库'
        } else if(status == 1){
          status ='经销商出库'
        } else if(status =='2'){
          status ='门店入库'
        } else {
          status ='门店已出库'
        }
        return h('div', status)
      }
    }, {
      title: '处理标记',
      key: 'isProcess',
      align: 'left',
      minWidth: 120,
      render: (h, p) => {
        let status = p.row.isProcess ? '已处理' : '未处理'
        return h('div', status)
      }
    }, {
        title: '处理时间',
        key: 'processDate',
        align: 'left',
        minWidth: 200
      }
    ],
    form: {
      stockOutSn:''
    }
  },
}
export default data
